#include<stdio.h>
#include"ringbuffer.h"


typedef struct STREAM_DATA
{
	struct OutRingBuffer * stream;
}STREAM_DATA;


void main()
{
	STREAM_DATA stream_data;

	rb_init(&stream_data.stream,1024*48);

	char *s1 = "123456789";
	char *s2 = "abcdefg";
	char *s3 = "wyong";

	rb_write(stream_data.stream,s1,10);
	printf("size1=%d\n",rb_data_size(stream_data.stream));

	rb_write(stream_data.stream,s2,10);
	printf("size2=%d\n",rb_data_size(stream_data.stream));
	
	rb_write(stream_data.stream,s3,10);
	printf("size3=%d\n",rb_data_size(stream_data.stream));

	char buff[100],buff1[100],buff2[100];
	rb_read(stream_data.stream,buff,10);
	printf("buff1=%s\n",buff);

	rb_read(stream_data.stream,buff1,10);
	printf("buff2=%s\n",buff1);

	rb_read(stream_data.stream,buff2,10);
	printf("buff3=%s\n",buff2);

	rb_del(stream_data.stream);
}
